package com.dony.shop.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dony.common.utils.SecurityUtils;
import com.dony.shop.domain.Supplier;
import com.dony.shop.mapper.SupplierMapper;
import com.dony.shop.service.ISupplierService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;


@Slf4j
@Service
public class SupplierServiceImpl extends ServiceImpl<SupplierMapper, Supplier> implements ISupplierService {


    @Override
    public List<Supplier> listByParam(Supplier supplier) {
        return list(new QueryWrapper<Supplier>().eq("tenant_id", SecurityUtils.getDeptId()));
    }

    @Override
    public List<Supplier> listAllSupplier() {
        QueryWrapper<Supplier> wrapper = new QueryWrapper<Supplier>();
        wrapper.eq("status", true)
                .eq("tenant_id", SecurityUtils.getDeptId());
        return list(wrapper);
    }
}
